package com.david.concurrent.notify.wait;


/**
 * @author wade
 * @version 1.0
 * @date 2021/7/19 17:00
 */
public class WaitNotifyInterupt {
    private final static Object lock=new Object();
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            try {
                System.out.println("---begin---");
                synchronized (lock){
                    lock.wait();
                }
                System.out.println("---end---");
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        t.start();
        Thread.sleep(1000);

        System.out.println("---begin interrupt t---");
        t.interrupt();
        System.out.println("---begin interrupt t---");
    }
}
